package com.joinway.framework.admin.core.service;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.joinway.framework.admin.bean.UserContext;
import com.joinway.framework.admin.core.constant.AdminWebConstants;
import com.joinway.framework.core.utils.FrameworkHelper;
import com.joinway.framework.support.logging.service.impl.EventLogService;

public class AdminEventLogService extends EventLogService {

	private final static Logger log = LoggerFactory.getLogger(AdminEventLogService.class);

	@Override
	protected String getUser() {
		HttpServletRequest request = FrameworkHelper.getHttpServletRequest();
		UserContext uc = request != null ? (UserContext)request.getSession().getAttribute(AdminWebConstants.USER_CONTEXT_KEY) : null;
		String user = uc != null ? uc.getUser().getLoginName() : null;
		
		return user;
	}
	
}

